package com.mz.ozy.mvp.presenter;


import android.app.Activity;

import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.BalanceDetailBean;
import com.mz.ozy.mvp.model.BalanceDetailModel;
import com.mz.ozy.mvp.view.BalanceDetailContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class BalanceDetailPresenter extends BasePresenterImpl<BalanceDetailContract.View> implements BalanceDetailContract.Presenter {

    private BalanceDetailModel mModel;

    public BalanceDetailPresenter() {
        mModel = new BalanceDetailModel();
    }


    @Override
    public void getBalanceDetail(Activity activity, int type, String pageNo) {
        mModel.getBalanceDetail(activity, type, pageNo)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<BalanceDetailBean>(mView, false) {
                    @Override
                    public void onSuccesss(BalanceDetailBean bean) {
                        mView.getBalanceDetailSuccess(bean);
                    }
                });
    }
}
